<div xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/" >
<!-- ! Render the ticket field form based on ticket items defined in trac system -->

<!--! List existing tickets -->

<div>
<div id="ticketList" >
	<fieldset>
		<legend>Open Tickets</legend>
		<div id="tabs">
			<ul>
				<li py:for="open in opened">
					<a href="" ></a>
					<!-- 
					Note: Add feature to send comment variable to existing ticket. 
					This will populate the ticket commnet section with details referencing the 
					current test run. 
					
					Example
					Tester determines that a defect is found in step 5. 
					Several defects have already been registered. If the defect is similar 
					to an existing ticket, automatically populate the comment section with some
					information about the current testing experience. 
					"/ticket/1?comment=this+is+a+test+comment" 
					
					-->
				</li>
				<li>
					<a href="${href.report()}" target="_blank" >See All</a>
					
				</li>
			</ul>
		</div>
	</fieldset>	
</div>
<!--! Create new case  -->
<div id="ticketNew" >
	<form id="testticket_${step}" method="post" py:with="revoke_perm = 'PERMISSION_REVOKE' in perm" action="">
	<fieldset>
	   	<legend>Create ticket for Step [${step}] :</legend>
		<input type="hidden" name="reg_id" value="${reg}" />
		<input type="hidden" name="step_id" value="${step}" />
		<input type="hidden" name="ajax_request" value="Create Ticket" />
		
		
		<div >
			<div py:for="item in ticket" id="ticket_field" >
								
				<div py:choose="item.display">
					<span py:when="'yes'">
						<div py:choose="item.type">
							<span py:when="'text'">
								<label for="${item.name}">${item.label}:</label><input type="text" id="${item.name}" name="${item.name}"   />
							</span>
							<span py:when="'textarea'">
								<fieldset>
								<legend>${item.label}:</legend>
								<textarea id="desc_wiki_${step}" cols="85" rows="10" name="${item.name}" class="wikitext trac-resizable"  ></textarea>
								</fieldset>
							</span>
							<span py:when="'radio'">
								<fieldset>
									<legend>${item.label}</legend>
									<py:for each="option in item.options">
										<label for="option">${option}:</label><input type="radio" id="option" name="${item.name}" value="option" />
									</py:for>
								</fieldset>
							</span>
							<span py:when="'select'">
								
								<label for="${item.name}">${item.label}:</label> <select id="${item.name}" name="${item.name}" >
									<py:for each="option in item.options">
										<option value="option">${option}</option>
									</py:for>
								</select>
							</span>
						</div>
					</span>
					<!-- !
					<span py:when="'description'">
						<fieldset>
						<legend>${item.label}:</legend>
						<textarea id="desc_wiki_${step}" cols="85" rows="10" name="item.name" class="wikitext trac-resizable"  ></textarea>
						</fieldset>
					</span>
					-->
					
					<span py:otherwise="">
						<py:choose>
							<py:when test="item.value">
								<!-- Capture those values that have default settings -->
								<input type="hidden" name="${item.name}" value="${item.value}" />
							</py:when>
							<py:otherwise>
								<!-- Updated: 08/05/2011: Change default ticke create behavior to leave fields blank if no input value is given
										This will replace the current action of adding the values 'UNDEFINED' -->
								<input type="hidden" name="${item.name}" value="" />
							</py:otherwise>
						</py:choose>	
					</span> 
					
					
				</div>
			</div>
			<div>
				<input type="button" name="ajax_button" value="${_('Create Ticket')}" />
			</div>
		</div>
	</fieldset>
	</form>
</div>


</div>
</div>

